﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CMSModel;

public partial class news_NewsReBK_edit : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            string bkid = Request["bkid"];
            if (string.IsNullOrEmpty(bkid))
            {
                return;
            }
            CMSEntities cms = new CMSEntities();
            MainQuoteDBModel.MainQuoteDBEntities mDal = new MainQuoteDBModel.MainQuoteDBEntities();
            hidBkId.Value = bkid;
            lblBkName.Text = mDal.TB_BK.Where(x => x.BK_CODE == bkid).First().BK_NAME;
            var lst = cms.NewsReBK.Where(x => x.BkId == bkid).Select(x => new Display{ Id=x.Id, BkId=x.BkId, CTime=x.CTime, Key=x.Key }).ToList();
          
            for (int i = 0; i < lst.Count; i++)
            {
                var c = lst[0];
                c.BkName = mDal.TB_BK.Where(x => x.BK_CODE == c.BkId).First().BK_NAME;
            }
                Repeater1.DataSource = lst;
            Repeater1.DataBind();
        }
    }

    class Display
    {
        public int Id
        {
            get;
            set;
        }

        public string BkId
        {
            get;
            set;
        }

        public string BkName
        {
            get;
            set;
        }

        public string Key
        {
            get;
            set;
        }

        public DateTime? CTime
        {
            get;
            set;
        }
    }
}